interface Clocks<T, U> {
    year: T,
    month: T,
    day: T,
    hour: T | U,
    minutes: T | U,
    seconds: T | U,
    week: U
}

let clocks: Clocks<number, string>;
const weekArr: string[] = ["日", "一", "二", "三", "四", "五", "六"];

function getClock(): Clocks<number, string> {

    clocks.year = new Date().getFullYear();
    clocks.month = new Date().getMonth() + 1;
    clocks.day = new Date().getDate();
    let h = new Date().getHours();
    let m = new Date().getMinutes();
    let s = new Date().getSeconds();
    clocks.hour = h >= 10 ? h : `0${h}`;
    clocks.minutes = m >= 10 ? m : `0${m}`;
    clocks.seconds = s >= 10 ? s : `0${s}`;
    clocks.week = weekArr[new Date().getDay()];

    return clocks;
}

export default getClock;
